
<template>
  <div>
    <el-card>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>公众</el-breadcrumb-item>
        <el-breadcrumb-item>学期信息</el-breadcrumb-item>
      </el-breadcrumb>
      <div class="searchForm">

        <el-form :inline="true" class="demo-form-inline">
          <el-form-item>
            <el-input v-model="queryInfo.query" placeholder="请输入学期信息" clearable @clear="getUserList"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="" @click="getCourseList" icon="el-icon-search">查询</el-button>
          </el-form-item>
        </el-form>



        <el-table :header-cell-style="{background:'#808080',color:'#FFFFFF'}" border stripe :data="List" style="width: 100%">

          <el-table-column prop="termname" label="学期名称" width="380" align="center">
          </el-table-column>
          <el-table-column prop="termdes" label="学期描述" width="380" align="center">
          </el-table-column>
          <el-table-column prop="ords" label="次序" v-if="false" width="380" align="center">
          </el-table-column>




          <el-table-column label="学期课程" align="center">
            <template slot-scope="scope">
              <el-tooltip class="item" effect="dark" content="查看学期课程信息" placement="top-start">
                <el-button  icon="el-icon-s-fold" circle @click="showCourse(scope.row.termname,scope.row.ords)"></el-button>
              </el-tooltip>
            </template>
          </el-table-column>



        </el-table>
      </div>

      <div>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="queryInfo.pageNum"
          :page-sizes="[4]"
          :page-size="queryInfo.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
    </el-card>
  </div>
</template>


<script>
  export default {

    created(){
      this.getCourseList();
    },
    data() {
      return {
        queryInfo:{
          query:'',//查询信息
          role:'',
          pageNum:1,
          pageSize:4
        },
        List:[],
        total:0,
        addDialogVisible:false,
        editDialogVisible:false,
        infoDialogVisible:false,




      }
    },


    methods: {
      async getCourseList () {
        const { data: res } = await this.$http.get("Publics/AllProfesTerm", { params: this.queryInfo })
        this.List = res.data;
        this.total = res.numbers;
      },

      handleSizeChange (newSize) {
        this.queryInfo.pageSize = newSize;
        this.getCourseList();
      },
      handleCurrentChange (newPage) {
        this.queryInfo.pageNum = newPage;
        this.getCourseList();
      },
      logout(){
        window.sessionStorage.clear();
        this.$router.push({ path: "/login"});
      },
      showCourse (termname,ords) {
        this.$session.set("termname",termname);
        this.$session.set("ords",ords);
        this.$router.push({path:'/Pub_Course'});
      },
    }
  }
</script>




<style scoped>
  .el-header{
    background: lightslategray;
    color: white;
    font-size: 25px;
    align-items: center;
    justify-content: space-between;
    display: flex;
  }
  .el-main{
    background-color: whitesmoke;
  }

</style>
